package com.matt.repository;

import com.matt.domain.VideoCassetteRecorder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/12/8
 * *******************************
 */
public interface VideoCassetteRecorderRepository extends JpaRepository<VideoCassetteRecorder, String> {

    List<VideoCassetteRecorder> findByAreaIdAndIsDeleted(String areaId, Boolean isDeleted);

    VideoCassetteRecorder findByAreaIdAndAndSerialNumber(String areaId,String serialNumber);

    VideoCassetteRecorder findByIdAndAreaId(String id, String areaId);

    @Query(value = "select distinct areaId from video_cassette_recorder", nativeQuery = true)
    List<String> findAllAreaIdNeedRefresh();

}
